<template>
<div class="container__">
    <div class="boxinf">
        <van-field :value="addform.content" type="textarea" placeholder="请输入退款原因" :border=" false " @change="change" />
    </div>
    <div class="goods">
        <div class="body">
            <div class="thumb">
                <img :src="info.course_desc.thumb" alt="">
                <div class="postion"><img src="/static/images/status1.png" alt=""></div>
                </div>
                <div class="bodyinfo">
                    <div class="title">{{info.course_desc.title}}</div>

                    <div class="time">￥{{info.course_desc.price}}<span>￥{{info.course_desc.prime_price}}</span></div>
                </div>
            </div>
        </div>

        <div class="order">
            <div class="item">
                <span>应付款：</span><span>￥{{info.goods_amount}}</span>
            </div>
            <div class="item">
                <span>实付款：</span><span>￥{{info.total_fee}}</span>
            </div>
        </div>
        <div class="button" @click="submit">提交</div>
    </div>
</template>

<script>
import {
    ordertui
} from '@/api/my'

import {
    orderdetail
} from '@/api/my'
export default {
    data() {
        return {
            addform: {
                id: '',
                content: '',
            },
            info: {},
        }
    },
    methods: {
        change(e) {
            this.addform.content = e.mp.detail
        },
        submit() {
            if (!this.addform.content) return
            ordertui(this.addform).then(res => {
                if(res.code==200){
                    wx.navigateTo({
                        url: '/pages/course/main'
                    })
                }
            })
        },
        getinfo() {
            orderdetail(this.$mp.query.info).then(res => {
                this.info = res.data
            }).catch(err => {

            })
        }
    },
    onLoad() {
        this.addform.id = this.$mp.query.info
        this.getinfo()
    },
    onUnload(){
       Object.assign(this.$data, this.$options.data())
    }
}
</script>

<style lang="scss">
.container__ {
    background-color: #F4F5F5;
    min-height: 100vh;
    font-size: 16px;
    padding: 17px 0 35px 0;
    box-sizing: border-box;
    background: url('../../../static/images/1.png') no-repeat;
    background-size: contain;

    .van-cell {
        height: 100%;

        .van-field__body {
            height: 100%;

            .van-field__input {
                height: 100%;
            }
        }
    }

    .button {
        width: 345px;
        height: 45px;
        background: #1A84FB;
        border-radius: 5px;
        font-size: 15px;
        font-weight: bold;
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0 auto;
    }

    .boxinf {
        width: 345px;
        height: 185px;
        background: rgba(255, 255, 255, 1);
        box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.14);
        border-radius: 5px;
        margin: 0 auto 20px;

    }

    .order {
        margin: 0 auto;
        width: 345px;
        min-height: 176px;

        .item {
            padding: 10px 0;
            display: flex;
            justify-content: space-between;
            font-size: 12px;
            font-weight: 500;
            color: rgba(102, 102, 102, 1);
        }
    }

    .goods {
        padding: 0 15px;

        .body {
            display: flex;
            padding: 0 0 15px 0;
            border-bottom: 1px solid #DDD;
            box-sizing: border-box;
            justify-content: space-between;

            .thumb {
                height: 110px;
                width: 154px;
                position: relative;

                .postion {
                    position: absolute;
                    left: 0;
                    width: 54px;
                    height: 15px;
                    top: 5px;

                    img {
                        width: 100%;
                        height: 100%;
                    }
                }

                img {
                    width: 100%;
                    height: 100%;
                }
            }

            .bodyinfo {
                width: 181px;
                display: flex;
                flex-direction: column;
                justify-content: space-around;

                .title {
                    max-height: 32px;
                    font-size: 14px;
                    color: #333;
                    font-weight: bold;
                    line-height: 16px;
                    overflow: hidden;
                }

                .desc {
                    color: #46B7FF;
                    font-size: 14px;

                    span {
                        width: 60px;
                        height: 20px;
                        background: rgba(234, 247, 255, 1);
                        border: 1px solid rgba(70, 183, 255, 1);
                        border-radius: 10px;
                        // color :rgba(70, 183, 255, 1);
                        margin-right: 10px;
                    }
                }

                .desc1 {
                    color: #999999;
                    font-size: 14px;

                    span {
                        width: 60px;
                        height: 20px;
                        background: rgba(244, 245, 245, 1);
                        border: 1px solid rgba(153, 153, 153, 1);
                        border-radius: 10px;
                        margin-right: 10px;
                    }
                }

                .time {
                    font-size: 15px;
                    font-weight: bold;
                    color: #E9B55E;

                    span {
                        color: #666666;
                        text-decoration: line-through;
                        font-weight: 500;
                        font-size: 10px;
                        margin-left: 5px;
                    }
                }
            }
        }
    }
}
</style>
